package com.applink.sell_proof;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.applink.sell_proof.constant.Constant;
import com.applink.sell_proof.constant.NotificationKey;

public class DealNotificationDialog extends Activity implements
		android.view.View.OnClickListener {
	private long mDealId;
	private int mDealStage;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.deal_notify_dialog);
		String realDealId = getIntent().getStringExtra(NotificationKey.DEAL_ID);
		mDealId = Long.parseLong(realDealId);
		String stage = getIntent().getStringExtra(NotificationKey.DEAL_STAGE);
		mDealStage = Integer.parseInt(stage);

		((TextView) findViewById(R.id.message)).setText(getIntent()
				.getStringExtra(NotificationKey.MESSAGE));
		findViewById(R.id.btn_close).setOnClickListener(this);
		findViewById(R.id.btn_open).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_close:
			finish();
			break;
		case R.id.btn_open:
			Intent intentForward = new Intent(this, DealDetailActivity.class);
			intentForward.putExtra(Constant.INTENT_ID_DEAL, mDealId);
			intentForward.putExtra(Constant.INTENT_STAGE_DEAL, mDealStage);
			startActivity(intentForward);
			finish();
			break;
		default:
			break;
		}

	}

}
